import { http } from "@/utils/http";
const getPcToken = () => {
  return localStorage.getItem("pcToken");
};
const baseProxy = import.meta.env.VITE_BASEPROXY;
/** 获取档案管理列表 */
export const getArchivesById = (id?: number) => {
  return http.request<any>(
    "post",
    `${baseProxy}/acgArchives/queryArchivesList`,
    {
      data: {
        scriptId: id
      }
    },
    {
      headers: {
        pcToken: getPcToken()
      }
    }
  );
};

/** 删除档案 */
export const delArchives = (id?: number) => {
  return http.request<any>(
    "post",
    `${baseProxy}/acgArchives/deleteArchives`,
    {
      data: {
        id
      }
    },
    {
      headers: {
        pcToken: getPcToken()
      }
    }
  );
};

/** 新增档案 */
export const addArchives = (item?: object) => {
  return http.request<any>(
    "post",
    `${baseProxy}/acgArchives/createArchives`,
    {
      data: item
    },
    {
      headers: {
        pcToken: getPcToken()
      }
    }
  );
};

/** 更新档案 */
export const updateArchives = (item?: object) => {
  return http.request<any>(
    "post",
    `${baseProxy}/acgArchives/updateArchives`,
    {
      data: item
    },
    {
      headers: {
        pcToken: getPcToken()
      }
    }
  );
};
